﻿<?xml version="1.0" encoding="utf-8"?>
<Mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Entity type="Company" table="Company">
    <Id field="CompanyId">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" table="Company" field="Name" db-type="String" size="255" />
    <Reference name="Employees" entityChild="Employee">
      <Rule parentField="CompanyId" childTable="Employee" childField="FK_CompanyId" />
    </Reference>
  </Entity>
  <Entity type="Factory" table="Factory">
    <Id field="CompanyId">
      <Generator name="inherited" />
    </Id>
    <Attribute name="ProductType" table="Factory" field="ProductType" db-type="String" size="255" />
  </Entity>
  <Entity type="Bakery" table="Bakery">
    <Id field="CompanyId">
      <Generator name="inherited" />
    </Id>
    <Attribute name="BakeryType" table="Bakery" field="BakeryType" db-type="String" size="255" />
  </Entity>
  <Entity type="CarFactory" table="CarFactory">
    <Id field="CompanyId">
      <Generator name="inherited" />
    </Id>
    <Attribute name="CarType" table="CarFactory" field="CarType" db-type="String" size="255" />
  </Entity>
  <Entity type="Person" table="Person">
    <Id field="PersonId">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" table="Person" field="Name" db-type="String" size="255" />
    <Attribute name="Age" table="Person" field="Age" db-type="Int32" />
    <Reference name="Partners" entityChild="Person">
      <Rule parentField="PersonId" childTable="Person" childField="FK_PersonId" />
    </Reference>
  </Entity>
  <Entity type="Employee" table="Employee">
    <Id field="PersonId">
      <Generator name="inherited" />
    </Id>
    <Attribute name="Salary" table="Employee" field="Salary" db-type="Int32" />
  </Entity>
  <Entity type="Secretary" table="Secretary">
    <Id field="PersonId">
      <Generator name="inherited" />
    </Id>
    <Attribute name="Bonus" table="Secretary" field="Bonus" db-type="Int32" />
  </Entity>
  <Entity type="Worker" table="Worker">
    <Id field="PersonId">
      <Generator name="inherited" />
    </Id>
    <Attribute name="WorkingPlace" table="Worker" field="WorkingPlace" db-type="String" size="255" />
  </Entity>
</Mapping>